

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'dart:math' as Math;

class MyAnimatedRoute extends MaterialPageRoute {
  MyAnimatedRoute({WidgetBuilder builder}) : super(builder: builder);
}

/*
class MyAnimatedRoute extends PageRoute {
  WidgetBuilder builder;
  BuildContext context;
  MyAnimatedRoute({this.builder});
  @override
  Widget buildPage(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation) {
    return builder(context);
  }
  @override
  Widget buildTransitions(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) {
    var value1 = _MyCurve().transform(animation.value);
    var value2 = _MyCurve().transform(secondaryAnimation.value);
    var moveDistance = 120;
    var rotation = 0.6;
    var scale = 0.9;

    Widget buildingWidget = child;
//    buildingWidget = Container(
//      child: buildingWidget,
//      decoration: BoxDecoration(
//        border: Border.all(color: Colors.red, width: 1.0)
//      ),
//    );
    buildingWidget = Transform.scale(
      child: buildingWidget,
      scale: animation.value * scale + (1 - scale),
    );
    buildingWidget = Transform.rotate(
      angle: rotation - (animation.value * rotation),
      child: buildingWidget,
    );
    buildingWidget = Transform.translate(
      offset: Offset(value1 * moveDistance, 0.0),
      child: buildingWidget,
    );
    buildingWidget = Opacity(
      opacity: animation.value,
      child: buildingWidget,
    );
    /*****************************/
    buildingWidget = Transform.scale(
      scale: 1 - secondaryAnimation.value * scale,
      child: buildingWidget,
    );
    buildingWidget = Transform.rotate(
      angle: secondaryAnimation.value * rotation,
      child: buildingWidget,
    );
    buildingWidget = Transform.translate(
      offset: Offset(-(value2 * moveDistance), 0.0),
      child: buildingWidget,
    );
    buildingWidget = Opacity(
      opacity: 1 - secondaryAnimation.value,
      child: buildingWidget,
    );
    return buildingWidget;
  }
  double _map({double sourceFrom, double sourceTo, double destinationFrom, double destinationTo, double value}) {
    var difference1 = sourceTo - sourceFrom;
    var difference2 = destinationTo - destinationFrom;
    return ((value / difference1) * difference2) + destinationFrom;
  }
//  @override
//  // TODO: implement animation
  Animation<double> get animation => CurvedAnimation(parent: super.animation, curve: Curves.easeInOut);
//  @override
//  // TODO: implement secondaryAnimation
  Animation<double> get secondaryAnimation => CurvedAnimation(parent: super.secondaryAnimation, curve: Curves.easeInOut);
  @override
  // TODO: implement barrierColor
  Color get barrierColor => null;

  @override
  // TODO: implement barrierLabel
  String get barrierLabel => null;

  @override
  // TODO: implement maintainState
  bool get maintainState => true;

  @override
  // TODO: implement transitionDuration
  Duration get transitionDuration => Duration(milliseconds: 600);
}

class _MyCurve extends Curve {
  @override
  double transform(double t) {
    t = Math.sin(3.14 * t);
    return t;
  }
}
*/